// pages/test/test.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    myFormData: {
      formData: {
        1: "",
        2: "",
        3: "",
        4: "",
        5: "",
        test_slot: "",
        test_area:""
      },
      options: [{
          title: "调查总穴数",
          key: "1",
          type: "selector",
          rules: true,
          option: {
            data: [{
                id: 1,
                name: "选项1"
              },
              {
                id: 2,
                name: "选项2"
              },
              {
                id: 3,
                name: "选项3"
              },
              {
                id: 4,
                name: "选项4"
              }
            ],
            props: {
              key: "name"
            }
          }
        },
        {
          title: "调查总株数",
          key: "2",
          type: "selector",
          rules: true,
          option: {
            data: ["选项1", "选项2", "选项3"]
          }
        },
        {
          title: "调查总穗数",
          key: "3",
          type: "text",
          rules: true
        },
        {
          title: "活虫数",
          key: "4",
          type: "textarea",
          rules: true
        },
        {
          title: "数字",
          key: "5",
          type: "number",
          rules: true
        },
        {
          title:"",
          key: "test_slot",
          slot: true
        },
        {
          title:"",
          key: "test_area",
          slot: true
        }
      ],
      rules: []
    },
  },

  // 提交表单
  submitForm() {
    // 获取组件对象
    const myForm = this.selectComponent("#my-form");
    // 调用验证方法
    if (myForm.validate()) {
      console.log(myForm.data.formData);
    }
  }
})